/*
 * serial.h
 *
 *  Created on: Oct 8, 2011
 *      Author: mvoorsluys
 */


#ifndef SERIAL_H_
#define SERIAL_H_

#define BUFFERSIZE 128
#define BAUD 38400

#include <avr/io.h>
#include <avr/interrupt.h>
#include <avr/iom16.h>

struct ring_buffer{
	char buffer[BUFFERSIZE];
	int head;
	int tail;
}input_buffer;

void serial_init();
void flush_serial();

int serial_read();
void serial_writte(unsigned char* data, int length);

ISR(USART_RXC_vect);

#endif /* SERIAL_H_ */
